import { createRouter, createWebHistory } from 'vue-router'
// //导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'

import ActivitiesManageVue from '@/views/activities/ActivitiesManage.vue'
import ActivityAddVue from '@/views/activities/ActivityAdd.vue'
import UserAvatarVue from '@/views/user/UserAvatar.vue'
import UserInfoVue from '@/views/user/UserInfo.vue'
import UserResetPasswordVue from '@/views/user/UserResetPassword.vue'
import UserDeleteVue from '@/views/user/UserDelete.vue'
import UserManageVue from '@/views/user/UserManage.vue'
import ChatVue from '@/views/activities/Chat.vue'
import MyActivitiesVue from '@/views/activities/MyActivities.vue'
import NewsListVue from '@/views/news/NewsList.vue'

//定义路由关系
const routes = [
    { path: '/login', component: LoginVue },
    {
        path: '/', component: LayoutVue,
        redirect: '/activities/manage',
        children: [
            { path: '/activities/manage', component: ActivitiesManageVue },
            { path: '/activities/all', component: ActivityAddVue },
            { path: '/activities/add', component: MyActivitiesVue },
            { path: '/activities/chat', component: ChatVue },
            { path: '/user/manage', component: UserManageVue },
            { path: '/user/info', component: UserInfoVue },
            { path: '/user/avatar', component: UserAvatarVue },
            { path: '/user/resetPassword', component: UserResetPasswordVue },
            { path: '/user', component: UserDeleteVue },
            { path: '/news/newsList', component: NewsListVue}
        ]
    }
]

//创建路由
const router = createRouter({
    history: createWebHistory(),
    routes: routes
});


// //导出路由
export default router